package client;

import common.LogUtil;
import common.ServiceMapping;

import java.net.InetSocketAddress;
import java.util.logging.Logger;

/**
 * 本地服务实现
 */
public class LocalService {
    private static final Logger logger = LogUtil.getLogger(LocalService.class.getName());

    // 关联的服务管理器
    private final ServiceManager serviceManager;

    // 服务配置
    private final ServiceMapping config;

    /**
     * 构造函数
     */
    public LocalService(ServiceManager serviceManager, ServiceMapping config) {
        this.serviceManager = serviceManager;
        this.config = config;
    }

    /**
     * 获取本地服务地址
     */
    public InetSocketAddress getLocalAddress() {
        return new InetSocketAddress(config.getLocalHost(), config.getLocalPort());
    }

    /**
     * 获取服务管理器
     */
    public ServiceManager getServiceManager() {
        return serviceManager;
    }

    /**
     * 获取服务配置
     */
    public ServiceMapping getConfig() {
        return config;
    }
}
